//
//  ByRecommendCodeVC.m
//  caipiao_ios
//
//  Created by mc on 2018/9/27.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByRecommendCodeVC.h"

@interface ByRecommendCodeVC ()

@property (nonatomic, strong) UILabel *valueLabel;
@property (nonatomic, strong) UILongPressGestureRecognizer *tap;

@end

@implementation ByRecommendCodeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addLeftBackBarButtonItem];
    self.title = @"我的推荐码";
    
    
    
    UILabel *valueLabel = [[UILabel alloc] init];
    [self.view addSubview:valueLabel];
    [valueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view).offset(0);
        make.centerY.equalTo(self.view).offset(0);
        make.size.mas_equalTo(CGSizeMake(200, 100));
    }];
    valueLabel.numberOfLines = 0;
    valueLabel.textColor = [UIColor blackColor];
    valueLabel.font = FONT(36);
    valueLabel.textAlignment = NSTextAlignmentCenter;
    valueLabel.text = BY_USER.invitation_code;
    self.valueLabel = valueLabel;
    UILongPressGestureRecognizer *tap = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(copy1:)];
    [valueLabel addGestureRecognizer:tap];
    valueLabel.userInteractionEnabled = YES;
    self.tap = tap;
    // Do any additional setup after loading the view.
}

- (void)copy1:(id)sender {
    [self.valueLabel removeGestureRecognizer:self.tap];
    [ByCoreToolAlert showOnlyText:@"复制成功"];
    [[UIPasteboard generalPasteboard] setString:self.valueLabel.text];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
